1. Field of the Invention
The present invention relates to an image processing method, apparatus and program, as well as an imaging apparatus, and more particularly, to a technique of preventing color attachment in exposure correction with respect to a digital image.
2. Description of the Related Art
In a RAW file, digital image data (RAW data) in which a light amount captured by an imaging element at the time of shooting with a digital camera has been A/D converted is directly recorded.
In order to output (display or print) the RAW data as an appropriate image, it is necessary to apply various image processes such as white balance correction, exposure correction, gamma correction and a synchronization process. However, at the same time, there is an advantage of great flexibility for a user to correct the image to suit the user's preferences.
For example, when the RAW data is multiplied by R, G and B gains by the white balance correction, even a non-blown-out highlight portion in which highlight is not blown out (less than or equal to a maximum value of a digital value which can be outputted) in the RAW data may be blown out highlight. However, information on a blown-out highlight portion can be restored by setting exposure to be underexposed and performing development (which is a desensitization process).
Japanese Patent Application Laid-Open No. 11-317873 describes an image correction apparatus which uses a value of a highlight portion and a value of a shadow portion in image data obtained by analyzing an image, to perform the exposure correction.
When the white balance correction is performed, luminance varies accordingly. Japanese Patent Application Laid-Open No. 2002-118857 describes a white balance adjustment apparatus which calculates a correction gain for correcting the luminance variation as at least two color gains among the R, G and B gains, and adjusts white balance with the at least two color correction gains which have been calculated.
Japanese Patent Application Laid-Open No. 2006-135708 describes a digital camera which controls a charge storage time of an imaging element independently for each color according to a white balance correction value to prevent a gain (noise) of a particular color signal from being too large.
Incidentally, as described above, even in the digital image including the blown-out highlight due to the white balance correction, the information on the blown-out highlight portion can be restored by performing the desensitization process. However, on the portion in which highlight is blown out due to the white balance correction (blown-out highlighting portion), blown-out amounts are not uniform for each of R, G and B. Therefore, when the desensitization process is performed with respect to this portion, there is a problem that undesirable color is attached to the blown-out highlight portion.
On the other hand, if the desensitization process is performed while preventing the undesirable color from attaching to the blown-out highlight portion, there is a problem that an exposure amount in which the desensitization process can be applied (a restorable width) is decreased.
With respect to this, the image correction apparatus according to Japanese Patent Application Laid-Open No. 11-317873 is applied in a range of a pixel value which has not blown-out highlight at the time of normal exposure, and therefore, the color attachment with respect to the blown-out highlight portion cannot be prevented at the time of the exposure correction.
Similarly, the white balance adjustment apparatus according to Japanese Patent Application Laid-Open No. 2002-118857 equally applies corrected correction gains to all pixels, and therefore, the color attachment with respect to the blown-out highlight portion cannot be prevented at the time of the exposure correction. Moreover, in the digital camera according to Japanese Patent Application Laid-Open No. 2006-135708, when the white balance of the digital image shot with the above described camera is changed after the shooting, maximum gain values of respective colors which have been equal become uneven, and consequently, there is a problem in which the color attachment with respect to the blown-out highlight portion cannot be prevented at the time of the exposure correction.